// $ANTLR 3.1.2 C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g 2009-03-27 15:56:27

 package real;
  
 import real.lang.*;
 import real.evaluation.*;


import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;


import org.antlr.runtime.tree.*;

public class RealSetConstructionParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "LCURLY", "NEWLINE", "FORALL", "EXISTS", "NOT", "SUCH_THAT", "ID", "OR", "AND", "RCURLY", "WS", "CMT", "'.'", "'('", "')'", "'is'", "'in'", "'a'", "'subset'", "'of'", "'superset'"
    };
    public static final int T__24=24;
    public static final int T__23=23;
    public static final int T__22=22;
    public static final int T__21=21;
    public static final int T__20=20;
    public static final int FORALL=6;
    public static final int LCURLY=4;
    public static final int NOT=8;
    public static final int AND=12;
    public static final int ID=10;
    public static final int EOF=-1;
    public static final int T__19=19;
    public static final int CMT=15;
    public static final int WS=14;
    public static final int T__16=16;
    public static final int T__18=18;
    public static final int NEWLINE=5;
    public static final int T__17=17;
    public static final int RCURLY=13;
    public static final int OR=11;
    public static final int EXISTS=7;
    public static final int SUCH_THAT=9;

    // delegates
    // delegators


        public RealSetConstructionParser(TokenStream input) {
            this(input, new RecognizerSharedState());
        }
        public RealSetConstructionParser(TokenStream input, RecognizerSharedState state) {
            super(input, state);
             
        }
        
    protected TreeAdaptor adaptor = new CommonTreeAdaptor();

    public void setTreeAdaptor(TreeAdaptor adaptor) {
        this.adaptor = adaptor;
    }
    public TreeAdaptor getTreeAdaptor() {
        return adaptor;
    }

    public String[] getTokenNames() { return RealSetConstructionParser.tokenNames; }
    public String getGrammarFileName() { return "C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g"; }


    public static class setConstruction_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "setConstruction"
    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:36:1: setConstruction : ( element | element SUCH_THAT formula );
    public final RealSetConstructionParser.setConstruction_return setConstruction() throws RecognitionException {
        RealSetConstructionParser.setConstruction_return retval = new RealSetConstructionParser.setConstruction_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token SUCH_THAT3=null;
        RealSetConstructionParser.element_return element1 = null;

        RealSetConstructionParser.element_return element2 = null;

        RealSetConstructionParser.formula_return formula4 = null;


        CommonTree SUCH_THAT3_tree=null;

        try {
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:37:3: ( element | element SUCH_THAT formula )
            int alt1=2;
            alt1 = dfa1.predict(input);
            switch (alt1) {
                case 1 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:37:5: element
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_element_in_setConstruction142);
                    element1=element();

                    state._fsp--;

                    adaptor.addChild(root_0, element1.getTree());

                    }
                    break;
                case 2 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:38:3: element SUCH_THAT formula
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_element_in_setConstruction148);
                    element2=element();

                    state._fsp--;

                    adaptor.addChild(root_0, element2.getTree());
                    SUCH_THAT3=(Token)match(input,SUCH_THAT,FOLLOW_SUCH_THAT_in_setConstruction150); 
                    SUCH_THAT3_tree = (CommonTree)adaptor.create(SUCH_THAT3);
                    adaptor.addChild(root_0, SUCH_THAT3_tree);

                    pushFollow(FOLLOW_formula_in_setConstruction152);
                    formula4=formula();

                    state._fsp--;

                    adaptor.addChild(root_0, formula4.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "setConstruction"

    public static class element_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "element"
    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:41:1: element : ( ID | inset );
    public final RealSetConstructionParser.element_return element() throws RecognitionException {
        RealSetConstructionParser.element_return retval = new RealSetConstructionParser.element_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token ID5=null;
        RealSetConstructionParser.inset_return inset6 = null;


        CommonTree ID5_tree=null;

        try {
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:41:9: ( ID | inset )
            int alt2=2;
            int LA2_0 = input.LA(1);

            if ( (LA2_0==ID) ) {
                int LA2_1 = input.LA(2);

                if ( (LA2_1==EOF||LA2_1==SUCH_THAT) ) {
                    alt2=1;
                }
                else if ( ((LA2_1>=19 && LA2_1<=20)) ) {
                    alt2=2;
                }
                else {
                    NoViableAltException nvae =
                        new NoViableAltException("", 2, 1, input);

                    throw nvae;
                }
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 2, 0, input);

                throw nvae;
            }
            switch (alt2) {
                case 1 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:41:11: ID
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    ID5=(Token)match(input,ID,FOLLOW_ID_in_element164); 
                    ID5_tree = (CommonTree)adaptor.create(ID5);
                    adaptor.addChild(root_0, ID5_tree);


                    }
                    break;
                case 2 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:41:16: inset
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_inset_in_element168);
                    inset6=inset();

                    state._fsp--;

                    adaptor.addChild(root_0, inset6.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "element"

    public static class formula_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "formula"
    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:43:1: formula : ( FORALL inset '.' compositePredicate | EXISTS inset '.' compositePredicate );
    public final RealSetConstructionParser.formula_return formula() throws RecognitionException {
        RealSetConstructionParser.formula_return retval = new RealSetConstructionParser.formula_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token FORALL7=null;
        Token char_literal9=null;
        Token EXISTS11=null;
        Token char_literal13=null;
        RealSetConstructionParser.inset_return inset8 = null;

        RealSetConstructionParser.compositePredicate_return compositePredicate10 = null;

        RealSetConstructionParser.inset_return inset12 = null;

        RealSetConstructionParser.compositePredicate_return compositePredicate14 = null;


        CommonTree FORALL7_tree=null;
        CommonTree char_literal9_tree=null;
        CommonTree EXISTS11_tree=null;
        CommonTree char_literal13_tree=null;

        try {
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:44:7: ( FORALL inset '.' compositePredicate | EXISTS inset '.' compositePredicate )
            int alt3=2;
            int LA3_0 = input.LA(1);

            if ( (LA3_0==FORALL) ) {
                alt3=1;
            }
            else if ( (LA3_0==EXISTS) ) {
                alt3=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 3, 0, input);

                throw nvae;
            }
            switch (alt3) {
                case 1 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:44:9: FORALL inset '.' compositePredicate
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    FORALL7=(Token)match(input,FORALL,FOLLOW_FORALL_in_formula183); 
                    FORALL7_tree = (CommonTree)adaptor.create(FORALL7);
                    adaptor.addChild(root_0, FORALL7_tree);

                    pushFollow(FOLLOW_inset_in_formula185);
                    inset8=inset();

                    state._fsp--;

                    adaptor.addChild(root_0, inset8.getTree());
                    char_literal9=(Token)match(input,16,FOLLOW_16_in_formula187); 
                    char_literal9_tree = (CommonTree)adaptor.create(char_literal9);
                    adaptor.addChild(root_0, char_literal9_tree);

                    pushFollow(FOLLOW_compositePredicate_in_formula189);
                    compositePredicate10=compositePredicate();

                    state._fsp--;

                    adaptor.addChild(root_0, compositePredicate10.getTree());

                    }
                    break;
                case 2 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:45:9: EXISTS inset '.' compositePredicate
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    EXISTS11=(Token)match(input,EXISTS,FOLLOW_EXISTS_in_formula200); 
                    EXISTS11_tree = (CommonTree)adaptor.create(EXISTS11);
                    adaptor.addChild(root_0, EXISTS11_tree);

                    pushFollow(FOLLOW_inset_in_formula202);
                    inset12=inset();

                    state._fsp--;

                    adaptor.addChild(root_0, inset12.getTree());
                    char_literal13=(Token)match(input,16,FOLLOW_16_in_formula204); 
                    char_literal13_tree = (CommonTree)adaptor.create(char_literal13);
                    adaptor.addChild(root_0, char_literal13_tree);

                    pushFollow(FOLLOW_compositePredicate_in_formula206);
                    compositePredicate14=compositePredicate();

                    state._fsp--;

                    adaptor.addChild(root_0, compositePredicate14.getTree());

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "formula"

    public static class compositePredicate_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "compositePredicate"
    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:48:1: compositePredicate : orExpr ;
    public final RealSetConstructionParser.compositePredicate_return compositePredicate() throws RecognitionException {
        RealSetConstructionParser.compositePredicate_return retval = new RealSetConstructionParser.compositePredicate_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        RealSetConstructionParser.orExpr_return orExpr15 = null;



        try {
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:48:20: ( orExpr )
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:48:22: orExpr
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_orExpr_in_compositePredicate221);
            orExpr15=orExpr();

            state._fsp--;

            adaptor.addChild(root_0, orExpr15.getTree());

            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "compositePredicate"

    public static class orExpr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "orExpr"
    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:50:1: orExpr : andExpr ( OR andExpr )* ;
    public final RealSetConstructionParser.orExpr_return orExpr() throws RecognitionException {
        RealSetConstructionParser.orExpr_return retval = new RealSetConstructionParser.orExpr_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token OR17=null;
        RealSetConstructionParser.andExpr_return andExpr16 = null;

        RealSetConstructionParser.andExpr_return andExpr18 = null;


        CommonTree OR17_tree=null;

        try {
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:50:7: ( andExpr ( OR andExpr )* )
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:50:9: andExpr ( OR andExpr )*
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_andExpr_in_orExpr228);
            andExpr16=andExpr();

            state._fsp--;

            adaptor.addChild(root_0, andExpr16.getTree());
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:50:17: ( OR andExpr )*
            loop4:
            do {
                int alt4=2;
                int LA4_0 = input.LA(1);

                if ( (LA4_0==OR) ) {
                    alt4=1;
                }


                switch (alt4) {
            	case 1 :
            	    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:50:18: OR andExpr
            	    {
            	    OR17=(Token)match(input,OR,FOLLOW_OR_in_orExpr231); 
            	    OR17_tree = (CommonTree)adaptor.create(OR17);
            	    adaptor.addChild(root_0, OR17_tree);

            	    pushFollow(FOLLOW_andExpr_in_orExpr233);
            	    andExpr18=andExpr();

            	    state._fsp--;

            	    adaptor.addChild(root_0, andExpr18.getTree());

            	    }
            	    break;

            	default :
            	    break loop4;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "orExpr"

    public static class andExpr_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "andExpr"
    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:52:1: andExpr : atomicPredicate ( AND atomicPredicate )* ;
    public final RealSetConstructionParser.andExpr_return andExpr() throws RecognitionException {
        RealSetConstructionParser.andExpr_return retval = new RealSetConstructionParser.andExpr_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token AND20=null;
        RealSetConstructionParser.atomicPredicate_return atomicPredicate19 = null;

        RealSetConstructionParser.atomicPredicate_return atomicPredicate21 = null;


        CommonTree AND20_tree=null;

        try {
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:52:8: ( atomicPredicate ( AND atomicPredicate )* )
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:52:10: atomicPredicate ( AND atomicPredicate )*
            {
            root_0 = (CommonTree)adaptor.nil();

            pushFollow(FOLLOW_atomicPredicate_in_andExpr243);
            atomicPredicate19=atomicPredicate();

            state._fsp--;

            adaptor.addChild(root_0, atomicPredicate19.getTree());
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:52:26: ( AND atomicPredicate )*
            loop5:
            do {
                int alt5=2;
                int LA5_0 = input.LA(1);

                if ( (LA5_0==AND) ) {
                    alt5=1;
                }


                switch (alt5) {
            	case 1 :
            	    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:52:27: AND atomicPredicate
            	    {
            	    AND20=(Token)match(input,AND,FOLLOW_AND_in_andExpr246); 
            	    AND20_tree = (CommonTree)adaptor.create(AND20);
            	    adaptor.addChild(root_0, AND20_tree);

            	    pushFollow(FOLLOW_atomicPredicate_in_andExpr248);
            	    atomicPredicate21=atomicPredicate();

            	    state._fsp--;

            	    adaptor.addChild(root_0, atomicPredicate21.getTree());

            	    }
            	    break;

            	default :
            	    break loop5;
                }
            } while (true);


            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "andExpr"

    public static class atomicPredicate_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "atomicPredicate"
    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:54:1: atomicPredicate : ( inset | not_inset | subset | superset | '(' compositePredicate ')' );
    public final RealSetConstructionParser.atomicPredicate_return atomicPredicate() throws RecognitionException {
        RealSetConstructionParser.atomicPredicate_return retval = new RealSetConstructionParser.atomicPredicate_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token char_literal26=null;
        Token char_literal28=null;
        RealSetConstructionParser.inset_return inset22 = null;

        RealSetConstructionParser.not_inset_return not_inset23 = null;

        RealSetConstructionParser.subset_return subset24 = null;

        RealSetConstructionParser.superset_return superset25 = null;

        RealSetConstructionParser.compositePredicate_return compositePredicate27 = null;


        CommonTree char_literal26_tree=null;
        CommonTree char_literal28_tree=null;

        try {
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:54:16: ( inset | not_inset | subset | superset | '(' compositePredicate ')' )
            int alt6=5;
            alt6 = dfa6.predict(input);
            switch (alt6) {
                case 1 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:54:18: inset
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_inset_in_atomicPredicate257);
                    inset22=inset();

                    state._fsp--;

                    adaptor.addChild(root_0, inset22.getTree());

                    }
                    break;
                case 2 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:54:26: not_inset
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_not_inset_in_atomicPredicate261);
                    not_inset23=not_inset();

                    state._fsp--;

                    adaptor.addChild(root_0, not_inset23.getTree());

                    }
                    break;
                case 3 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:54:38: subset
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_subset_in_atomicPredicate265);
                    subset24=subset();

                    state._fsp--;

                    adaptor.addChild(root_0, subset24.getTree());

                    }
                    break;
                case 4 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:54:47: superset
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    pushFollow(FOLLOW_superset_in_atomicPredicate269);
                    superset25=superset();

                    state._fsp--;

                    adaptor.addChild(root_0, superset25.getTree());

                    }
                    break;
                case 5 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:55:3: '(' compositePredicate ')'
                    {
                    root_0 = (CommonTree)adaptor.nil();

                    char_literal26=(Token)match(input,17,FOLLOW_17_in_atomicPredicate274); 
                    pushFollow(FOLLOW_compositePredicate_in_atomicPredicate278);
                    compositePredicate27=compositePredicate();

                    state._fsp--;

                    adaptor.addChild(root_0, compositePredicate27.getTree());
                    char_literal28=(Token)match(input,18,FOLLOW_18_in_atomicPredicate280); 

                    }
                    break;

            }
            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "atomicPredicate"

    public static class inset_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "inset"
    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:58:1: inset : ID ( 'is' )? 'in' ID ;
    public final RealSetConstructionParser.inset_return inset() throws RecognitionException {
        RealSetConstructionParser.inset_return retval = new RealSetConstructionParser.inset_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token ID29=null;
        Token string_literal30=null;
        Token string_literal31=null;
        Token ID32=null;

        CommonTree ID29_tree=null;
        CommonTree string_literal30_tree=null;
        CommonTree string_literal31_tree=null;
        CommonTree ID32_tree=null;

        try {
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:58:8: ( ID ( 'is' )? 'in' ID )
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:58:10: ID ( 'is' )? 'in' ID
            {
            root_0 = (CommonTree)adaptor.nil();

            ID29=(Token)match(input,ID,FOLLOW_ID_in_inset292); 
            ID29_tree = (CommonTree)adaptor.create(ID29);
            adaptor.addChild(root_0, ID29_tree);

            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:58:13: ( 'is' )?
            int alt7=2;
            int LA7_0 = input.LA(1);

            if ( (LA7_0==19) ) {
                alt7=1;
            }
            switch (alt7) {
                case 1 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:58:13: 'is'
                    {
                    string_literal30=(Token)match(input,19,FOLLOW_19_in_inset294); 
                    string_literal30_tree = (CommonTree)adaptor.create(string_literal30);
                    adaptor.addChild(root_0, string_literal30_tree);


                    }
                    break;

            }

            string_literal31=(Token)match(input,20,FOLLOW_20_in_inset298); 
            string_literal31_tree = (CommonTree)adaptor.create(string_literal31);
            adaptor.addChild(root_0, string_literal31_tree);

            ID32=(Token)match(input,ID,FOLLOW_ID_in_inset300); 
            ID32_tree = (CommonTree)adaptor.create(ID32);
            adaptor.addChild(root_0, ID32_tree);


            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "inset"

    public static class not_inset_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "not_inset"
    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:60:1: not_inset : ID ( 'is' )? NOT 'in' ID ;
    public final RealSetConstructionParser.not_inset_return not_inset() throws RecognitionException {
        RealSetConstructionParser.not_inset_return retval = new RealSetConstructionParser.not_inset_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token ID33=null;
        Token string_literal34=null;
        Token NOT35=null;
        Token string_literal36=null;
        Token ID37=null;

        CommonTree ID33_tree=null;
        CommonTree string_literal34_tree=null;
        CommonTree NOT35_tree=null;
        CommonTree string_literal36_tree=null;
        CommonTree ID37_tree=null;

        try {
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:60:12: ( ID ( 'is' )? NOT 'in' ID )
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:60:14: ID ( 'is' )? NOT 'in' ID
            {
            root_0 = (CommonTree)adaptor.nil();

            ID33=(Token)match(input,ID,FOLLOW_ID_in_not_inset309); 
            ID33_tree = (CommonTree)adaptor.create(ID33);
            adaptor.addChild(root_0, ID33_tree);

            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:60:17: ( 'is' )?
            int alt8=2;
            int LA8_0 = input.LA(1);

            if ( (LA8_0==19) ) {
                alt8=1;
            }
            switch (alt8) {
                case 1 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:60:17: 'is'
                    {
                    string_literal34=(Token)match(input,19,FOLLOW_19_in_not_inset311); 
                    string_literal34_tree = (CommonTree)adaptor.create(string_literal34);
                    adaptor.addChild(root_0, string_literal34_tree);


                    }
                    break;

            }

            NOT35=(Token)match(input,NOT,FOLLOW_NOT_in_not_inset314); 
            NOT35_tree = (CommonTree)adaptor.create(NOT35);
            adaptor.addChild(root_0, NOT35_tree);

            string_literal36=(Token)match(input,20,FOLLOW_20_in_not_inset316); 
            string_literal36_tree = (CommonTree)adaptor.create(string_literal36);
            adaptor.addChild(root_0, string_literal36_tree);

            ID37=(Token)match(input,ID,FOLLOW_ID_in_not_inset318); 
            ID37_tree = (CommonTree)adaptor.create(ID37);
            adaptor.addChild(root_0, ID37_tree);


            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "not_inset"

    public static class subset_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "subset"
    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:62:1: subset : ID ( 'is' )? ( 'a' )? 'subset' ( 'of' )? ID ;
    public final RealSetConstructionParser.subset_return subset() throws RecognitionException {
        RealSetConstructionParser.subset_return retval = new RealSetConstructionParser.subset_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token ID38=null;
        Token string_literal39=null;
        Token char_literal40=null;
        Token string_literal41=null;
        Token string_literal42=null;
        Token ID43=null;

        CommonTree ID38_tree=null;
        CommonTree string_literal39_tree=null;
        CommonTree char_literal40_tree=null;
        CommonTree string_literal41_tree=null;
        CommonTree string_literal42_tree=null;
        CommonTree ID43_tree=null;

        try {
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:62:9: ( ID ( 'is' )? ( 'a' )? 'subset' ( 'of' )? ID )
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:62:11: ID ( 'is' )? ( 'a' )? 'subset' ( 'of' )? ID
            {
            root_0 = (CommonTree)adaptor.nil();

            ID38=(Token)match(input,ID,FOLLOW_ID_in_subset327); 
            ID38_tree = (CommonTree)adaptor.create(ID38);
            adaptor.addChild(root_0, ID38_tree);

            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:62:14: ( 'is' )?
            int alt9=2;
            int LA9_0 = input.LA(1);

            if ( (LA9_0==19) ) {
                alt9=1;
            }
            switch (alt9) {
                case 1 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:62:14: 'is'
                    {
                    string_literal39=(Token)match(input,19,FOLLOW_19_in_subset329); 
                    string_literal39_tree = (CommonTree)adaptor.create(string_literal39);
                    adaptor.addChild(root_0, string_literal39_tree);


                    }
                    break;

            }

            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:62:20: ( 'a' )?
            int alt10=2;
            int LA10_0 = input.LA(1);

            if ( (LA10_0==21) ) {
                alt10=1;
            }
            switch (alt10) {
                case 1 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:62:20: 'a'
                    {
                    char_literal40=(Token)match(input,21,FOLLOW_21_in_subset332); 
                    char_literal40_tree = (CommonTree)adaptor.create(char_literal40);
                    adaptor.addChild(root_0, char_literal40_tree);


                    }
                    break;

            }

            string_literal41=(Token)match(input,22,FOLLOW_22_in_subset335); 
            string_literal41_tree = (CommonTree)adaptor.create(string_literal41);
            adaptor.addChild(root_0, string_literal41_tree);

            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:62:34: ( 'of' )?
            int alt11=2;
            int LA11_0 = input.LA(1);

            if ( (LA11_0==23) ) {
                alt11=1;
            }
            switch (alt11) {
                case 1 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:62:34: 'of'
                    {
                    string_literal42=(Token)match(input,23,FOLLOW_23_in_subset337); 
                    string_literal42_tree = (CommonTree)adaptor.create(string_literal42);
                    adaptor.addChild(root_0, string_literal42_tree);


                    }
                    break;

            }

            ID43=(Token)match(input,ID,FOLLOW_ID_in_subset340); 
            ID43_tree = (CommonTree)adaptor.create(ID43);
            adaptor.addChild(root_0, ID43_tree);


            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "subset"

    public static class superset_return extends ParserRuleReturnScope {
        CommonTree tree;
        public Object getTree() { return tree; }
    };

    // $ANTLR start "superset"
    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:64:1: superset : ID ( 'is' )? ( 'a' )? 'superset' ( 'of' )? ID ;
    public final RealSetConstructionParser.superset_return superset() throws RecognitionException {
        RealSetConstructionParser.superset_return retval = new RealSetConstructionParser.superset_return();
        retval.start = input.LT(1);

        CommonTree root_0 = null;

        Token ID44=null;
        Token string_literal45=null;
        Token char_literal46=null;
        Token string_literal47=null;
        Token string_literal48=null;
        Token ID49=null;

        CommonTree ID44_tree=null;
        CommonTree string_literal45_tree=null;
        CommonTree char_literal46_tree=null;
        CommonTree string_literal47_tree=null;
        CommonTree string_literal48_tree=null;
        CommonTree ID49_tree=null;

        try {
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:64:10: ( ID ( 'is' )? ( 'a' )? 'superset' ( 'of' )? ID )
            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:64:12: ID ( 'is' )? ( 'a' )? 'superset' ( 'of' )? ID
            {
            root_0 = (CommonTree)adaptor.nil();

            ID44=(Token)match(input,ID,FOLLOW_ID_in_superset348); 
            ID44_tree = (CommonTree)adaptor.create(ID44);
            adaptor.addChild(root_0, ID44_tree);

            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:64:15: ( 'is' )?
            int alt12=2;
            int LA12_0 = input.LA(1);

            if ( (LA12_0==19) ) {
                alt12=1;
            }
            switch (alt12) {
                case 1 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:64:15: 'is'
                    {
                    string_literal45=(Token)match(input,19,FOLLOW_19_in_superset350); 
                    string_literal45_tree = (CommonTree)adaptor.create(string_literal45);
                    adaptor.addChild(root_0, string_literal45_tree);


                    }
                    break;

            }

            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:64:21: ( 'a' )?
            int alt13=2;
            int LA13_0 = input.LA(1);

            if ( (LA13_0==21) ) {
                alt13=1;
            }
            switch (alt13) {
                case 1 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:64:21: 'a'
                    {
                    char_literal46=(Token)match(input,21,FOLLOW_21_in_superset353); 
                    char_literal46_tree = (CommonTree)adaptor.create(char_literal46);
                    adaptor.addChild(root_0, char_literal46_tree);


                    }
                    break;

            }

            string_literal47=(Token)match(input,24,FOLLOW_24_in_superset356); 
            string_literal47_tree = (CommonTree)adaptor.create(string_literal47);
            adaptor.addChild(root_0, string_literal47_tree);

            // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:64:37: ( 'of' )?
            int alt14=2;
            int LA14_0 = input.LA(1);

            if ( (LA14_0==23) ) {
                alt14=1;
            }
            switch (alt14) {
                case 1 :
                    // C:\\Users\\ewger\\workspace\\real\\src\\RealSetConstruction.g:64:37: 'of'
                    {
                    string_literal48=(Token)match(input,23,FOLLOW_23_in_superset358); 
                    string_literal48_tree = (CommonTree)adaptor.create(string_literal48);
                    adaptor.addChild(root_0, string_literal48_tree);


                    }
                    break;

            }

            ID49=(Token)match(input,ID,FOLLOW_ID_in_superset361); 
            ID49_tree = (CommonTree)adaptor.create(ID49);
            adaptor.addChild(root_0, ID49_tree);


            }

            retval.stop = input.LT(-1);

            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "superset"

    // Delegated rules


    protected DFA1 dfa1 = new DFA1(this);
    protected DFA6 dfa6 = new DFA6(this);
    static final String DFA1_eotS =
        "\15\uffff";
    static final String DFA1_eofS =
        "\1\uffff\1\4\5\uffff\2\4\4\uffff";
    static final String DFA1_minS =
        "\1\12\1\11\1\24\1\12\2\uffff\1\12\2\11\4\uffff";
    static final String DFA1_maxS =
        "\1\12\2\24\1\12\2\uffff\1\12\2\11\4\uffff";
    static final String DFA1_acceptS =
        "\4\uffff\1\1\1\2\7\uffff";
    static final String DFA1_specialS =
        "\15\uffff}>";
    static final String[] DFA1_transitionS = {
            "\1\1",
            "\1\5\11\uffff\1\2\1\3",
            "\1\6",
            "\1\7",
            "",
            "",
            "\1\10",
            "\1\5",
            "\1\5",
            "",
            "",
            "",
            ""
    };

    static final short[] DFA1_eot = DFA.unpackEncodedString(DFA1_eotS);
    static final short[] DFA1_eof = DFA.unpackEncodedString(DFA1_eofS);
    static final char[] DFA1_min = DFA.unpackEncodedStringToUnsignedChars(DFA1_minS);
    static final char[] DFA1_max = DFA.unpackEncodedStringToUnsignedChars(DFA1_maxS);
    static final short[] DFA1_accept = DFA.unpackEncodedString(DFA1_acceptS);
    static final short[] DFA1_special = DFA.unpackEncodedString(DFA1_specialS);
    static final short[][] DFA1_transition;

    static {
        int numStates = DFA1_transitionS.length;
        DFA1_transition = new short[numStates][];
        for (int i=0; i<numStates; i++) {
            DFA1_transition[i] = DFA.unpackEncodedString(DFA1_transitionS[i]);
        }
    }

    class DFA1 extends DFA {

        public DFA1(BaseRecognizer recognizer) {
            this.recognizer = recognizer;
            this.decisionNumber = 1;
            this.eot = DFA1_eot;
            this.eof = DFA1_eof;
            this.min = DFA1_min;
            this.max = DFA1_max;
            this.accept = DFA1_accept;
            this.special = DFA1_special;
            this.transition = DFA1_transition;
        }
        public String getDescription() {
            return "36:1: setConstruction : ( element | element SUCH_THAT formula );";
        }
    }
    static final String DFA6_eotS =
        "\22\uffff";
    static final String DFA6_eofS =
        "\22\uffff";
    static final String DFA6_minS =
        "\1\12\1\10\1\uffff\1\10\2\uffff\1\26\2\uffff\1\26\10\uffff";
    static final String DFA6_maxS =
        "\1\21\1\30\1\uffff\1\30\2\uffff\1\30\2\uffff\1\30\10\uffff";
    static final String DFA6_acceptS =
        "\2\uffff\1\5\1\uffff\1\2\1\1\1\uffff\1\3\1\4\11\uffff";
    static final String DFA6_specialS =
        "\22\uffff}>";
    static final String[] DFA6_transitionS = {
            "\1\1\6\uffff\1\2",
            "\1\4\12\uffff\1\3\1\5\1\6\1\7\1\uffff\1\10",
            "",
            "\1\4\13\uffff\1\5\1\11\1\7\1\uffff\1\10",
            "",
            "",
            "\1\7\1\uffff\1\10",
            "",
            "",
            "\1\7\1\uffff\1\10",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            ""
    };

    static final short[] DFA6_eot = DFA.unpackEncodedString(DFA6_eotS);
    static final short[] DFA6_eof = DFA.unpackEncodedString(DFA6_eofS);
    static final char[] DFA6_min = DFA.unpackEncodedStringToUnsignedChars(DFA6_minS);
    static final char[] DFA6_max = DFA.unpackEncodedStringToUnsignedChars(DFA6_maxS);
    static final short[] DFA6_accept = DFA.unpackEncodedString(DFA6_acceptS);
    static final short[] DFA6_special = DFA.unpackEncodedString(DFA6_specialS);
    static final short[][] DFA6_transition;

    static {
        int numStates = DFA6_transitionS.length;
        DFA6_transition = new short[numStates][];
        for (int i=0; i<numStates; i++) {
            DFA6_transition[i] = DFA.unpackEncodedString(DFA6_transitionS[i]);
        }
    }

    class DFA6 extends DFA {

        public DFA6(BaseRecognizer recognizer) {
            this.recognizer = recognizer;
            this.decisionNumber = 6;
            this.eot = DFA6_eot;
            this.eof = DFA6_eof;
            this.min = DFA6_min;
            this.max = DFA6_max;
            this.accept = DFA6_accept;
            this.special = DFA6_special;
            this.transition = DFA6_transition;
        }
        public String getDescription() {
            return "54:1: atomicPredicate : ( inset | not_inset | subset | superset | '(' compositePredicate ')' );";
        }
    }
 

    public static final BitSet FOLLOW_element_in_setConstruction142 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_element_in_setConstruction148 = new BitSet(new long[]{0x0000000000000200L});
    public static final BitSet FOLLOW_SUCH_THAT_in_setConstruction150 = new BitSet(new long[]{0x00000000000000C0L});
    public static final BitSet FOLLOW_formula_in_setConstruction152 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ID_in_element164 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_inset_in_element168 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_FORALL_in_formula183 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_inset_in_formula185 = new BitSet(new long[]{0x0000000000010000L});
    public static final BitSet FOLLOW_16_in_formula187 = new BitSet(new long[]{0x0000000000020400L});
    public static final BitSet FOLLOW_compositePredicate_in_formula189 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_EXISTS_in_formula200 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_inset_in_formula202 = new BitSet(new long[]{0x0000000000010000L});
    public static final BitSet FOLLOW_16_in_formula204 = new BitSet(new long[]{0x0000000000020400L});
    public static final BitSet FOLLOW_compositePredicate_in_formula206 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_orExpr_in_compositePredicate221 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_andExpr_in_orExpr228 = new BitSet(new long[]{0x0000000000000802L});
    public static final BitSet FOLLOW_OR_in_orExpr231 = new BitSet(new long[]{0x0000000000020400L});
    public static final BitSet FOLLOW_andExpr_in_orExpr233 = new BitSet(new long[]{0x0000000000000802L});
    public static final BitSet FOLLOW_atomicPredicate_in_andExpr243 = new BitSet(new long[]{0x0000000000001002L});
    public static final BitSet FOLLOW_AND_in_andExpr246 = new BitSet(new long[]{0x0000000000020400L});
    public static final BitSet FOLLOW_atomicPredicate_in_andExpr248 = new BitSet(new long[]{0x0000000000001002L});
    public static final BitSet FOLLOW_inset_in_atomicPredicate257 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_not_inset_in_atomicPredicate261 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_subset_in_atomicPredicate265 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_superset_in_atomicPredicate269 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_17_in_atomicPredicate274 = new BitSet(new long[]{0x0000000000020400L});
    public static final BitSet FOLLOW_compositePredicate_in_atomicPredicate278 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_18_in_atomicPredicate280 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ID_in_inset292 = new BitSet(new long[]{0x0000000000180000L});
    public static final BitSet FOLLOW_19_in_inset294 = new BitSet(new long[]{0x0000000000100000L});
    public static final BitSet FOLLOW_20_in_inset298 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_ID_in_inset300 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ID_in_not_inset309 = new BitSet(new long[]{0x0000000000080100L});
    public static final BitSet FOLLOW_19_in_not_inset311 = new BitSet(new long[]{0x0000000000000100L});
    public static final BitSet FOLLOW_NOT_in_not_inset314 = new BitSet(new long[]{0x0000000000100000L});
    public static final BitSet FOLLOW_20_in_not_inset316 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_ID_in_not_inset318 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ID_in_subset327 = new BitSet(new long[]{0x0000000000680000L});
    public static final BitSet FOLLOW_19_in_subset329 = new BitSet(new long[]{0x0000000000600000L});
    public static final BitSet FOLLOW_21_in_subset332 = new BitSet(new long[]{0x0000000000400000L});
    public static final BitSet FOLLOW_22_in_subset335 = new BitSet(new long[]{0x0000000000800400L});
    public static final BitSet FOLLOW_23_in_subset337 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_ID_in_subset340 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ID_in_superset348 = new BitSet(new long[]{0x0000000001280000L});
    public static final BitSet FOLLOW_19_in_superset350 = new BitSet(new long[]{0x0000000001200000L});
    public static final BitSet FOLLOW_21_in_superset353 = new BitSet(new long[]{0x0000000001000000L});
    public static final BitSet FOLLOW_24_in_superset356 = new BitSet(new long[]{0x0000000000800400L});
    public static final BitSet FOLLOW_23_in_superset358 = new BitSet(new long[]{0x0000000000000400L});
    public static final BitSet FOLLOW_ID_in_superset361 = new BitSet(new long[]{0x0000000000000002L});

}